package com.hsh.maoduo.controller;

import com.hsh.maoduo.common.Result;
import com.hsh.maoduo.pojo.dto.SupplierDTO;
import com.hsh.maoduo.pojo.vo.SupplierVO;
import com.hsh.maoduo.service.SupplierService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/supplier")
public class SupplierController {


    @Resource
    private SupplierService supplierService;

    @GetMapping("/list")
    public List<SupplierDTO> getList(SupplierVO supplierVO) {
        return supplierService.getList(supplierVO);
    }

    @PostMapping("/addOne")
    public Result addOne(SupplierVO supplierVO) {
        return supplierService.addOne(supplierVO);
    }

    @PostMapping("/update")
    public Result update(SupplierVO supplierVO) {
        return supplierService.update(supplierVO);
    }

    @PostMapping("/delete")
    public Result delete(int id) {
        return supplierService.delete(id);
    }
}
